package com.cy3;

import java.util.HashSet;

public class HashSetDemo2 {
    public static void main(String[] args) {
        HashSet<Student> hs = new HashSet<>();
        hs.add(new Student("lqx",25));
        hs.add(new Student("zmy",25));
        hs.add(new Student("王祖贤",25));
        hs.add(new Student("lqx",25));//此处与第一处的对象成员变量相同，我们认为它们是同一对象，不能添加到
        //HashSet中
        for (Student j : hs) {
            System.out.println(j);
        }

    }
}
